<?php
/* @var $this AssignmentController */
/* @var $dataProvider CActiveDataProvider */
$this->breadcrumbs = array(
		Yii::t('AuthModule.main', 'Assignments'),
);


$this->addPageOption(
		BSHtml::button('高级搜索',array('class' =>'search-button', 'icon' => BSHtml::GLYPHICON_SEARCH,'color' => BSHtml::BUTTON_COLOR_PRIMARY), '#')
);



Yii::app()->clientScript->registerScript('search',
"
    $('.search-button').click(function(){
        $('.search-form').toggle();
            return false;
        });
        $('.search-form form').submit(function(){
            $('#user-admin-grid').yiiGridView('update', {
            data: $(this).serialize()
        });
        return false;
    });"
);
?>

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-danger">
			<div class="panel-heading">
				<h4>用户授权</h4>
				<div class="options">
				<?php $this->widget(
        'bootstrap.widgets.BsNav',
        array(
            'type' => BSHtml::NAV_TYPE_TABS,
            'items' => array(
                array(
                    'label' => Yii::t('AuthModule.main', 'Assignments'),
                    'url' => array('/auth/assignment/index'),
                    'active' => $this instanceof AssignmentController,
                ),
                array(
                    'label' => $this->capitalize($this->getItemTypeText(CAuthItem::TYPE_ROLE, true)),
                    'url' => array('/auth/role/index'),
                    'active' => $this instanceof RoleController,
                ),
                array(
                    'label' => $this->capitalize($this->getItemTypeText(CAuthItem::TYPE_TASK, true)),
                    'url' => array('/auth/task/index'),
                    'active' => $this instanceof TaskController,
                ),
                array(
                    'label' => $this->capitalize($this->getItemTypeText(CAuthItem::TYPE_OPERATION, true)),
                    'url' => array('/auth/operation/index'),
                    'active' => $this instanceof OperationController,
                ),
            ),
        )
    );?>
    </div>
			</div>
			<div class="panel-body">
		        <div class="search-form" style="display:none">
		            <?php $this->renderPartial('_search',[
		                'model'=>$model,
		            ]); ?>
		        </div><!-- search-form -->

<?php $this->widget(
    'bootstrap.widgets.BsGridView',
    array(
        'type' => 'striped hover',
        'dataProvider' => $dataProvider,
        'emptyText' => Yii::t('AuthModule.main', 'No assignments found.'),
        'template' => "{items}\n{pager}",
        'columns' => array(
            array(
                'header' => Yii::t('AuthModule.main', 'User'),
                'class' => 'AuthAssignmentNameColumn',
            ),
            array(
                'header' => Yii::t('AuthModule.main', 'Assigned items'),
                'class' => 'AuthAssignmentItemsColumn',
            ),
            array(
                'class' => 'AuthAssignmentViewColumn',
            ),
        ),
    )
); ?>
</div> <!-- end panel-body -->
		</div>
	</div>
</div> <!-- end row -->
